Package-level declarations

Functions

Link copied to clipboard

Appends per-tool input examples to the tool description. For providers that don't natively accept examples on tool definitions (most of them besides Anthropic), this lets the example pairs influence the model via the description text instead.

Link copied to clipboard
fun defaultSettingsMiddleware(temperature: Float? = null, topP: Float? = null, topK: Int? = null, maxOutputTokens: Int? = null, stopSequences: List<String> = emptyList(), seed: Int? = null, tools: List<LanguageModelTool> = emptyList(), toolChoice: ToolChoice? = null, headers: Map<String, String> = emptyMap(), providerOptions: Map<String, JsonElement> = emptyMap(), presencePenalty: Float? = null, frequencyPenalty: Float? = null, responseFormat: ResponseFormat = ResponseFormat.Text): LanguageModelMiddleware

Applies default per-call settings to every model invocation. Explicitly provided params override defaults; provider option maps are merged.

Link copied to clipboard

Extracts JSON from text-only model output. For models that wrap their structured response in markdown code fences (```json {...} ``` ) or mix prose with the JSON, this strips the surrounding text and surfaces just the JSON object.

Link copied to clipboard
fun extractReasoningMiddleware(tagName: String = "reasoning", separator: String = "", startWithReasoning: Boolean = false): LanguageModelMiddleware

Extracts XML-tagged reasoning sections from generated text and surfaces them as separate ReasoningStart/Delta/End events.

Link copied to clipboard

Routes a model invocation's tool-call boundary + error events through an injected Logger — the port-side, provider-agnostic home for observability.

Link copied to clipboard

Wraps a non-streaming model into a fake streaming surface. Useful when a provider's batch-only generate is the only path available and the UI needs a stream contract.